package com.FOD.fragments;

import com.FOD.clases.DateCalendar;
import com.FOD.clases.R;
import com.FOD.clases.ShowBody;

import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
 
public class HomeFragment extends Fragment {
	ImageView calendarImage;
	ImageView showBody;
     
    public HomeFragment(){}
     
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.options_fragment, container, false);
        
        /*SessionDBHandler session = new SessionDBHandler(getActivity());
        User user = session.getUserDetails();
        PacienteUsuario paciente = session.getPatientUserDetails();
        
        Log.w("PROBANDO 123",String.valueOf(user.getId()));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		String date = sdf.format(user.getCreateDate());
        Log.w("PROBANDO 123",date);
        Log.w("PROBANDO 123",paciente.getDominancia());
        Log.w("PROBANDO 123",paciente.getOcupacion());*/
        
        calendarImage = (ImageView)rootView.findViewById(R.id.calendar_button);
        calendarImage.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent calendar = new Intent(getActivity(), DateCalendar.class);
				startActivity(calendar);
			}
		});
        showBody = (ImageView) rootView.findViewById(R.id.date_button);
        showBody.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent showBodyintent = new Intent(getActivity(), ShowBody.class);
				startActivity(showBodyintent);
			}
		});
        return rootView;
    }
    
  //Hide the keyboard when the Fragmenet is created
  	@Override
  	public void onActivityCreated(Bundle savedInstanceState) {
  		super.onActivityCreated(savedInstanceState);
  		final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  		imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
  	}
  	
	public void onBackPressed() {
		
	}
	
    
}